<?php
// +----------------------------------------------------------------------
// | 添加商标服务分类属性
// +----------------------------------------------------------------------
// | Copyright (c) 2015
// +----------------------------------------------------------------------
// | Author: baiping 125618036@qq.com http://www.webipcode.com
// +----------------------------------------------------------------------
// |2015-11-12 下午2:45:53
// +----------------------------------------------------------------------?>
<?php $this->load->view('public/header');?>
<?php $this->load->view('public/head');?>
<link rel="stylesheet" href="<?php echo __STATIC__?>jqueryfileupload/css/jquery.fileupload.css">  
<link rel="stylesheet" href="<?php echo __STATIC__?>jqueryfileupload/css/jquery.fileupload-ui.css">  
<script charset="utf-8" src="<?php echo __STATIC__?>kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<?php echo __STATIC__?>kindeditor/lang/zh_CN.js"></script>
<script>
$(document).ready(function(){
	var editor_q;
	KindEditor.ready(function(K) {
		editor_q = K.create('textarea[name="server_intro"]', {
			allowPreviewEmoticons : false,
			allowImageUpload : true,
			afterBlur:function(){
			   this.sync();
			},
			items : ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage','flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink', '|', 'about']
		});
	});
	var editor_1;
	KindEditor.ready(function(K) {
		editor_q = K.create('textarea[name="process"]', {
			allowPreviewEmoticons : false,
			allowImageUpload : false,
			afterBlur:function(){
			   this.sync();
			},
			items : ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage','flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink', '|', 'about']
		});
	});
	var editor_2;
	KindEditor.ready(function(K) {
		editor_q = K.create('textarea[name="required_information"]', {
			allowPreviewEmoticons : false,
			allowImageUpload : false,
			afterBlur:function(){
			   this.sync();
			},
			items : ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright','justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript','superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/','formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold','italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage','flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor', 'link', 'unlink', '|', 'about']
		});
	});
	var editor_3;
	KindEditor.ready(function(K) {
		editor_q = K.create('textarea[name="problem"]', {
			allowPreviewEmoticons : false,
			allowImageUpload : false,
			afterBlur:function(){
			   this.sync();
			},
		});
	});

})
</script>
<div class="container-fluid">
	<div class="row">
		<?php $this->load->view('public/sideleft');?>
		<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main ">
			<!-- 内容区 -->
			<div class="main-title">
				<h3>
					<?php echo $meta_title?>
				</h3>
			</div>
			<div class="con">
				<!-- 内容列表 -->
				<?php if($info->id > 0){ ?>
					<form name="creat_form" method="post" action="<?php echo site_url('trademark/modfiy/'.$info->id)?>">
					<input type="hidden" name="id" value="<?php echo $info->id?>" >
				<?php }else{?>
					<form name="creat_form" method="post" action="<?php echo site_url('trademark/add')?>">
				<?php }?>
					<div class="form-group col-md-3">
						<label>标题</label>
    					<input type="text" class="form-control" id="title" name="title" placeholder="属性标题" <?php if($info->id > 0){?>value="<?php echo $info->title ?>"<?php }else{?>value="<?php echo set_value('title')?>"<?php }?>>
  						<?php echo form_error("title",'<span class="text-danger">','</span>');?>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-3">
						<label>分类</label>
    					<select class="form-control" name="catid" id="catid" style="color:#000;">
    						<?php foreach($catgory as $key => $val){?>
    						<option value="<?php echo $val['id']?>" <?php if($val['disabled'] > 0){ ?> disabled <?php }?> ><?php echo $val['title_show']?></option>
    						<?php }?>
    					</select>
    					<?php echo form_error("catid",'<span class="text-danger">','</span>');?>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-3">
						<label>缩略图</label>
						<div id="progress">
						    
						</div> 
                        <input type="hidden" name="thumb" id="img_id_1"/>
                        <input type="hidden" name="thumb_id" id="img_val_1"/>
                        <span class="upfile_style">
                             <input class="publish_upfile_file" name="userfile" type="file" id="1"/>
                             <a href="javascript:void(0);" class="btn btn-primary btn-sm" >上传</a>
                        </span>
						
					</div>
					<span class="clearfix"></span>
					
					<div class="form-group col-md-3">
						<label>服务费</label>
						<div class="input-group">
					      <div class="input-group-addon">￥</div>
					      <input type="text" class="form-control" id="service_price" name="service_price" placeholder="服务费" <?php if($info->id > 0){?>value="<?php echo $info->service_price ?>"<?php }else{?>value="<?php echo set_value('service_price')?>"<?php }?>>
					      <div class="input-group-addon">.00元</div>
					    </div>
    					<?php echo form_error("service_price",'<span class="text-danger">','</span>');?>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-3">
						<label>官费</label>
    					<div class="input-group">
					      <div class="input-group-addon">￥</div>
					      <input type="text" class="form-control" id="officer_price" name="officer_price" placeholder="官费" <?php if($info->id > 0){?>value="<?php echo $info->officer_price ?>"<?php }else{?>value="<?php echo set_value('officer_price')?>"<?php }?>>
					      <div class="input-group-addon">.00元</div>
					    </div>
    					<?php echo form_error("officer_price",'<span class="text-danger">','</span>');?>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-12">
						<label>服务介绍</label>
    					<textarea name="server_intro" id="server_intro" class="form-control"><?php echo $info->server_intro ?></textarea>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-12">
						<label>办理流程<small class="color_9"></small></label>
    					<textarea name="process" id="process" class="form-control"><?php echo $info->process ?></textarea>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-12">
						<label>所需资料<small class="color_9"></small></label>
    					<textarea name="required_information" id="required_information" class="form-control"><?php echo $info->required_information ?></textarea>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-12">
						<label>常见问题<small class="color_9"></small></label>
    					<textarea name="problem" id="problem" class="form-control"><?php echo $info->problem ?></textarea>
					</div>
					<span class="clearfix"></span>
					<div class="form-group col-md-12">
						<label>是否推荐<small class="color_9">如果推荐请勾选</small><br>
						<input type="checkbox" name="recommend" id="recommend" value="1" <?php if($info->recommend == 1){?>checked<?php }?> >是
						</label>
					</div>
					<span class="clearfix"></span>
					<div class="form-group">
						<button type="submit" class="btn btn-primary">确认</button>
						<a class="btn btn-success" href="javascript:window.history.go(-1);">返回</a>
					</div>
				</form>	
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
//左侧菜单高亮显示
highlight_subnav( '<?php echo site_url('trademark/index')?>' );
</script>

<script type="text/javascript" src="<?php echo __STATIC__?>jqueryfileupload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" src="<?php echo __STATIC__?>jqueryfileupload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="<?php echo __STATIC__?>jqueryfileupload/js/jquery.fileupload.js"></script>
<script type="text/javascript">
/* 初始化上传插件 */
$('.publish_upfile_file').fileupload({
    dataType: 'json',
    autoUpload: true,
    acceptFileTypes:  /(\.|\/)(gif|jpe?g|png)$/i,
    maxNumberOfFiles : 1,
    url: "<?php echo site_url('File/uploadPicture'); ?>",//指向php的上传地址
    formData: {save_path:'catgory/'},
    done: function (e,result) {
    	var id = $(this).attr('id');
        if(result.result.status == 1){
          $("#img_id_"+id).val(result.result.data.path);
          $("#img_val_"+id).val(result.result.data.id);
          $("#img_"+id).prop('src','Uploads/'+result.result.data.path);
          $("#progress").html("<img src=/Uploads/"+ result.result.data.path +" width=100 height=40 />");
        } else {
          message_box.show(result.result.info,'error');
        }
    }
});

<?php if ($info->id > 0){?>
setValue('catid',<?php echo $info->cat_id?>);
<?php }else{?>
setValue('catid',0);
<?php }?>
</script>
<?php $this->load->view('public/footer');?>